package com.acwing.partition21;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/5/30 21:25
 */
public class AC2032过度种植_容斥原理 {

    private static final int N = 11, M = 10010, INF = 0x3f3f3f3f;
    private static Rect[] rects = new Rect[N];
    private static int n, m = 0;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        for (int i = 0; i < n; i++) {
            int x1 = nextInt(), y1 = nextInt(), x2 = nextInt(), y2 = nextInt();
            rects[i] = new Rect(x1, y2, x2, y1);
        }
        int ans = 0;
        for (int i = 1; i < 1 << n; i++) ans += get(i);
        writer.println(ans);
        writer.flush();
    }

    private static int get(int state) {
        int x1 = -INF, y1 = -INF, x2 = INF, y2 = INF;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if ((state >> i & 1) == 1) {
                x1 = Math.max(x1, rects[i].x1);
                y1 = Math.max(y1, rects[i].y1);
                x2 = Math.min(x2, rects[i].x2);
                y2 = Math.min(y2, rects[i].y2);
                cnt++;
            }
        }
        int res = Math.max(0, x2 - x1) * Math.max(0, y2 - y1);
        if ((cnt & 1) == 1) return res;
        return -res;
    }

    private static class Rect {
        private int x1, y1, x2, y2;

        public Rect(int x1, int y1, int x2, int y2) {
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x2;
            this.y2 = y2;
        }
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
